package docmanager.operation.roles;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import docmanager.business.objects.Rol;
import docmanager.db.ConnectionPool;

import bf.operation.Operation;
import bf.operation.OperationException;

public class OpListarRoles extends Operation {

	@Override
	public Map execute(HttpServletRequest request) throws OperationException {
		Map m = new HashMap();
		try {
			Connection conn = ConnectionPool.getConnection();
			List l = Rol.obtenerTodosRoles(conn);
			ConnectionPool.closeConn(conn);
			m.put("roles", l);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return m;
	}

	@Override
	public String getReturnURL() {
		// TODO Auto-generated method stub
		return "Roles/ListarRoles.jsp";
	}

}
